package com.mingtu.jgspatrol.converter;

import androidx.room.TypeConverter;

import com.blankj.utilcode.util.GsonUtils;
import com.google.gson.reflect.TypeToken;
import com.mingtu.jgspatrol.room.SignInEvent;

import java.lang.reflect.Type;
import java.util.List;

/**
 * @ClassName :
 * @Author : wkk
 * @Date : 2022-8-11 11:19:08
 * @Email : 1281573890@qq.com
 * @Eescription :
 */
public class MyAttachVOSBeanConverter {
    @TypeConverter
    public String objectToString(List<SignInEvent.MyattachVOSBean> list) {
        return GsonUtils.toJson(list);
    }

    @TypeConverter
    public List<SignInEvent.MyattachVOSBean> stringToObject(String json) {
        Type listType = new TypeToken<List<SignInEvent.MyattachVOSBean>>(){}.getType();
        return GsonUtils.fromJson(json, listType);
    }
}
